package com.yizn.learn.springext.converter;

import com.yizn.learn.springext.springmvcext.AuthInterceptor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.format.FormatterRegistry;
import org.springframework.stereotype.Component;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;

/**
 * project : my-learn
 * <p> 第三步，将新定义的类型转换器注入到spring容器中： </p>
 *
 * @author yisl
 * @date 2023-01-13【星期五】
 **/
@Component
public class WebConfig implements WebMvcConfigurer {

    @Autowired
    private DateConverter dateConverter;

    @Override
    public void addFormatters(FormatterRegistry registry) {
        registry.addConverter(dateConverter);
    }
}
